<#include "../common/_layout.html"/>
<@head title="流程">
<style type="text/css">
    .cll {
        background-color: #ddd;
    }
</style>
</@head>
<@layout menu='/activiti/model'>
<!-- Content Header (Page header) -->


<!-- Main content -->
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <form action="${ctx}/activiti/model" id="listForm" method="post" role="form">

                    <div class="box-body table-responsive no-padding">
                        <button type="button" class="btn btn-default" onclick="location.href='${ctx}/activiti/model/getAddPage'">新增</button>
                        <button type="button" id="deleteButton" disabled="disabled" class="btn btn-default"
                                onclick="deleteAll('${ctx}/activiti/model/delete')">删除
                        </button>
                        <table class="table table-hover">
                            <tr class="info">
                                <th title="ID"><input type="checkbox" id="allCheck"></th>
                                <th title="模型标识">模型标识</th>
                                <th title="模型名称">模型名称</th>
                                <th title="模型版本">模型版本</th>
                                <th title="创建时间">创建时间</th>
                                <th title="修改时间">修改时间</th>
                                <th>操作</th>
                            </tr>
                            <#list page.getList() as item>
                                <tr>
                                    <td><input type="checkbox" name="ids" value="${item.id!}"></td>
                                    <td>${item.key!}</td>
                                    <td>${item.name!}</td>
                                    <td>${item.version!}</td>
                                    <td>${item.createTime!}</td>
                                    <td>${item.lastUpdateTime!}</td>
                                    <td>
                                        <button type="button" class="btn btn-info"
                                                onclick="openmodal('${ctx}/processEditor/modeler.html?modelId=${item.id}')">编辑
                                        </button>
                                        <!--<button type="button" class="btn btn-info"-->
                                                <!--onclick="window.open('${ctx}/processEditor/modeler.html?modelId=${item.id}')">编辑-->
                                        <!--</button>-->
                                        <button type="button" class="btn btn-info"
                                                onclick="deploy('${item.id}')">部署
                                        </button>
                                    </td>
                                </tr>
                            </#list>
                        </table>
                        <#if (page.list?size>0)>
                            <#include "../common/pager.html">
                        </#if>
                    </div>
                </form>
            </div>
        </div>
    </div>
</section>
</@layout>
<@scripts>
<script type="text/javascript" src="${ctx}/adminlte/plugins/bootbox/bootbox.min.js"></script>
<script type="text/javascript" src="${ctx}/js/list.js"></script>
<script type="text/javascript" src="${ctx}/adminlte/plugins/layer/layer.js"></script>
<script type="text/javascript">
    $(document).ready(function () {


    });
    function openmodal(url) {
        layer.open({type: 2, title: "流程设计", closeBtn: 0, area: ["1024px", "768px"], content: url});
    }
    function deploy(id) {
        $.ajax({
            type : "post",
            url : "${ctx}/activiti/model/deploy",
            data : {
                id :id
            },
            dataType : "json",
            async : false,
            success : function(data) {
                bootbox.alert(data.message);
            },error: function(XMLHttpRequest, data) {
                alert("status："+XMLHttpRequest.status+"-message："+data.message);
            }
        });
    }

</script>
</@scripts>